neoGFX neogfx https://neogfx.io/wiki/index.php/Main_Page MediaWiki 1.40.1 first-letter Media Special Talk User User talk NeoGFX NeoGFX talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk Main Page 0 1 1 2023-10-27T15:53:34Z MediaWiki default 2 wikitext text/x-wiki <strong>MediaWiki has been installed.</strong> Consult the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents User's Guide] for information on using the wiki software. == Getting started == * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ] * [https://lists.wikimedia.org/postorius/lists/mediawiki-announce.lists.wikimedia.org/ MediaWiki release mailing list] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language] * [https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Combating_spam Learn how to combat spam on your wiki] 11cef88175cf81168a86e7c0327a5b2d7a1920f5 2 1 2023-10-29T11:08:15Z Leigh 1 wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, neos, that will be able to support a wide range of scripting languages (on release: neoscript, JavaScript and Lua); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL and Vulkan. 8e9cd9bbeab63400e38300123b8c44d0d45243a2 3 2 2023-10-29T11:08:56Z Leigh 1 wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, neos, that will be able to support a wide range of scripting languages (on release: neoscript, JavaScript and Lua); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL, DirectX and Vulkan. 340dc979a4858ea7180d3c1850f408f343b4e48e 13 3 2024-05-04T18:42:52Z Leigh 1 wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, neos, that will be able to support a wide range of scripting languages (on release: neoscript, JavaScript and Lua); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL, DirectX and Vulkan. == Featured Pages == [[Event System]] b3d5bb3211876283aaf9ae7a849eb7fe1f620d4c 14 13 2024-05-04T18:43:18Z Leigh 1 wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, neos, that will be able to support a wide range of scripting languages (on release: neoscript, JavaScript and Lua); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL, DirectX and Vulkan. == Featured Pages == * [[Event System]] db959c16065df4a7160291727f87f5dc351fc632 15 14 2024-05-04T18:43:51Z Leigh 1 /* Featured Pages */ wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, neos, that will be able to support a wide range of scripting languages (on release: neoscript, JavaScript and Lua); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL, DirectX and Vulkan. == Featured Pages == * '''[[Event System]]''' ab93c2eeed322a9fe7726b386ac805c0bf2e340e 25 15 2024-05-05T15:03:02Z Leigh 1 /* Featured Pages */ wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, neos, that will be able to support a wide range of scripting languages (on release: neoscript, JavaScript and Lua); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL, DirectX and Vulkan. == Featured Pages == * '''[[Naming Convention]]''' * '''[[Event System]]''' 1dcd2693ee06c1e5c8868febe766f6979864e739 30 25 2024-05-05T17:44:19Z Leigh 1 /* Features */ wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, ''neos'', that will be able to support a wide range of scripting languages (on release: ''neoscript'' and ''Lua''); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL, DirectX and Vulkan. == Featured Pages == * '''[[Naming Convention]]''' * '''[[Event System]]''' 26b605ee3852ec47d5d00b707c88149e3bd813a2 31 30 2024-05-05T17:44:57Z Leigh 1 wikitext text/x-wiki <strong>neoGFX C++ Application/Game Engine and Development Platform -- Coming Soon</strong> == Introduction == neoGFX is a C++ app/game engine and development platform targeted at app and game developers that wish to leverage modern GPUs for performant application user interfaces and game graphics. == Features == * clean modern C++20 design including full exception safety supporting various widget allocation patterns (stack, member variable or free store); * use of standard non-proprietary C++ data types including using standard string classes (UTF-8 encoding) and containers from the C++ standard library and Boost where possible; * simple, easy to use multi-threaded event system (an improvement over traditional signals and slots); * no baggage: neoGFX primarily contains only the GUI and graphics related functionality needed for creating apps and games; * full library of widgets and layout managers specifiable in RJSON (Relaxed JSON) using the included GUI designer tool; * CSS3 style sheet support with support for custom skins; * scripting engine, ''neos'', that will be able to support a wide range of scripting languages (on release: ''neoscript'' and ''Lua''); * sub-pixel text rendering; * simple window style for specifying that a window is "nested" rather than being a separate native desktop window; * "text_edit" widget supports multiple fonts, text colours (with optional gradient effects), colour emojis and rendering text in columns; * "Green" and "Turbo" modes to optimize CPU power consumption, fight #ClimateChange! * GPU shader rendered CSS3 compliant gradients with optional gaussian smoothing; * MVC (model-view-controller) related classes supporting robust and fast app design; * optional MDI support utilizing "nested" windows; * 2D, 2.5D and 3D game support: sprites, objects and physics; * Pure ECS (Entity-component-system) usable by both games and apps; * flexible asset management: texture images (e.g PNGs) can be stored in .zip archives which can be optionally embedded inside the program binary accessible using simple URLs; * support for OpenGL and Vulkan. == Featured Pages == * '''[[Naming Convention]]''' * '''[[Event System]]''' 356a8a9cc321689c63e0a08656dcb89194974ddd Event System 0 2 4 2024-05-04T18:32:43Z Leigh 1 Created page with "== neoGFX Event System == The neoGFX event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event re..." wikitext text/x-wiki == neoGFX Event System == The neoGFX event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 17511c54359cd5a647dee1a8667d383b3e871fb2 5 4 2024-05-04T18:33:43Z Leigh 1 Leigh moved page [[EventSystem]] to [[NeoGFX Event System]] without leaving a redirect wikitext text/x-wiki == neoGFX Event System == The neoGFX event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 17511c54359cd5a647dee1a8667d383b3e871fb2 6 5 2024-05-04T18:34:10Z Leigh 1 /* neoGFX Event System */ wikitext text/x-wiki The neoGFX event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 82d2afa9cab537b82e7edad5a4bab830c13c52dc 7 6 2024-05-04T18:35:25Z Leigh 1 wikitext text/x-wiki {{lowercase title}} The neoGFX event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 37274d71a6b529a3c7c60801bb27dfe52df5e2fa 8 7 2024-05-04T18:37:03Z Leigh 1 wikitext text/x-wiki The neoGFX event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 82d2afa9cab537b82e7edad5a4bab830c13c52dc 9 8 2024-05-04T18:37:37Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 42a62db5d74946548f75259d081e06e8092ed3f2 10 9 2024-05-04T18:37:55Z Leigh 1 Leigh moved page [[NeoGFX Event System]] to [[Event System]] without leaving a redirect wikitext text/x-wiki The ''neoGFX'' event system is both modern and simple and is an improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 42a62db5d74946548f75259d081e06e8092ed3f2 11 10 2024-05-04T18:38:36Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 9b64d22c103a92daf5fc2f536baf806a671bdfda 12 11 2024-05-04T18:38:55Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple, improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> f3f6509ecfb09ce8b86aee9f89978289b7d522e1 16 12 2024-05-04T18:44:12Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: neoGFX::event<int> wibble; public: void something() { wibble.trigger(42); // by default a synchronous trigger wibble.sync_trigger(42); // synchronous trigger wibble.async_trigger(42); // asynchronous trigger } }; </pre> 9b64d22c103a92daf5fc2f536baf806a671bdfda 17 16 2024-05-04T18:59:34Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: define_event(OurEvent, our_event, int) public: void something() { // Using event object directly OurEvent.trigger(42); // by default a synchronous trigger OurEvent.sync_trigger(42); // synchronous trigger OurEvent.async_trigger(42); // asynchronous trigger // Using event (virtual) function our_event().trigger(42); // by default a synchronous trigger our_event().sync_trigger(42); // synchronous trigger our_event().async_trigger(42); // asynchronous trigger } }; class i_xyzzy // an interface (abstract base) class { public: declare_event(our_event, int) public: virtual ~i_frumple() = default; public: /* ... code ... */ }; class xyzzy : public i_xyzzy // a concrete class implementing the interface i_frumple { public: define_declared_event(OurEvent, our_event, int) public: /* ... code ... */ }; </pre> cb5cdadd2044975f31ecae6f47b4a9f42d7f9891 18 17 2024-05-04T19:01:38Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neoGFX::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: define_event(OurEvent, our_event, int) public: void something() { // Using event object directly OurEvent.trigger(42); // by default a synchronous trigger OurEvent.sync_trigger(42); // synchronous trigger OurEvent.async_trigger(42); // asynchronous trigger // Using event (virtual) function our_event().trigger(42); // by default a synchronous trigger our_event().sync_trigger(42); // synchronous trigger our_event().async_trigger(42); // asynchronous trigger } }; class i_xyzzy // an interface (abstract base) class { public: declare_event(our_event, int) public: virtual ~i_frumple() = default; public: virtual void qux() = 0; /* ... code ... */ }; class xyzzy : public i_xyzzy // a concrete class implementing the interface i_frumple { public: define_declared_event(OurEvent, our_event, int) public: void qux() final {} /* ... code ... */ }; </pre> a228c76dc341be4c5e830072674817cc6cabf0a7 19 18 2024-05-04T19:01:50Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neogfx::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: define_event(OurEvent, our_event, int) public: void something() { // Using event object directly OurEvent.trigger(42); // by default a synchronous trigger OurEvent.sync_trigger(42); // synchronous trigger OurEvent.async_trigger(42); // asynchronous trigger // Using event (virtual) function our_event().trigger(42); // by default a synchronous trigger our_event().sync_trigger(42); // synchronous trigger our_event().async_trigger(42); // asynchronous trigger } }; class i_xyzzy // an interface (abstract base) class { public: declare_event(our_event, int) public: virtual ~i_frumple() = default; public: virtual void qux() = 0; /* ... code ... */ }; class xyzzy : public i_xyzzy // a concrete class implementing the interface i_frumple { public: define_declared_event(OurEvent, our_event, int) public: void qux() final {} /* ... code ... */ }; </pre> ca0b5a8d2e84f78cc4adb987ddf4aa5b3a10ff38 20 19 2024-05-04T19:02:32Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neogfx::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: define_event(OurEvent, our_event, int) public: void something() { // Using event object directly OurEvent.trigger(42); // by default a synchronous trigger OurEvent.sync_trigger(42); // synchronous trigger OurEvent.async_trigger(42); // asynchronous trigger // Using event (virtual) function our_event().trigger(42); // by default a synchronous trigger our_event().sync_trigger(42); // synchronous trigger our_event().async_trigger(42); // asynchronous trigger } }; class i_xyzzy // an interface (abstract base) class { public: declare_event(our_event, int) public: virtual ~i_frumple() = default; public: virtual void qux() = 0; /* ... code ... */ }; class xyzzy : public i_xyzzy // a concrete class implementing the above interface { public: define_declared_event(OurEvent, our_event, int) public: void qux() final {} /* ... code ... */ }; </pre> e37c25ef2ce34492aad446882810c19c19ea0ac2 21 20 2024-05-04T19:09:10Z 94.6.161.247 0 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neogfx::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: define_event(OurEvent, our_event, int) public: void something() { // Using event object directly OurEvent.trigger(42); // by default a synchronous trigger OurEvent.sync_trigger(42); // synchronous trigger OurEvent.async_trigger(42); // asynchronous trigger // Using event (virtual) function our_event().trigger(42); // by default a synchronous trigger our_event().sync_trigger(42); // synchronous trigger our_event().async_trigger(42); // asynchronous trigger } }; class i_xyzzy // an interface (abstract base) class { public: declare_event(our_event, int) public: virtual ~i_xyzzy() = default; public: virtual void qux() = 0; /* ... code ... */ }; class xyzzy : public i_xyzzy // a concrete class implementing the above interface { public: define_declared_event(OurEvent, our_event, int) public: void qux() final {} /* ... code ... */ }; </pre> e5ab101d68099f8c81597f60575ddfad00ad6ddb 22 21 2024-05-04T21:53:14Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <code> button1.clicked([](){ /* ... code ... */ }); </code> If automatic event handler de-registration (traditional role of a "slot") is wanted: <code> neogfx::sink s; s += button1.clicked([](){ /* ... code ... */ }); </code> When 's' is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <nowiki>~~~~</nowiki>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: define_event(OurEvent, our_event, int) public: void something() { // Using event object directly OurEvent.trigger(42); // by default a synchronous trigger OurEvent.sync_trigger(42); // synchronous trigger OurEvent.async_trigger(42); // asynchronous trigger // Using event (virtual) function our_event().trigger(42); // by default a synchronous trigger our_event().sync_trigger(42); // synchronous trigger our_event().async_trigger(42); // asynchronous trigger } }; class i_xyzzy // an interface (abstract base) class { public: declare_event(our_event, int) public: virtual ~i_xyzzy() = default; public: virtual void qux() = 0; /* ... other interface methods or helper functions ... */ }; class xyzzy : public i_xyzzy // a concrete class implementing the above interface { public: define_declared_event(OurEvent, our_event, int) public: void qux() final {} /* ... code ... */ }; </pre> 993e3df00731ca0205a34daeb726fa13e4c1015c 23 22 2024-05-05T12:03:52Z 94.6.161.247 0 wikitext text/x-wiki The ''neoGFX'' event system is a modern, simple improvement over traditional signals and slots. To create an event handler simply use a lambda expression thus: <pre> button1.clicked([](){ /* ... code ... */ }); </pre> If automatic event handler de-registration (traditional role of a "slot") is wanted: <pre> neogfx::sink s; s += button1.clicked([](){ /* ... code ... */ }); </pre> When <code>s</code> is destroyed any associated event registrations are de-registered automatically. Sink objects can be on the stack, member variables or the more traditional slot-like base class sub-object. The event system is fully multi-threaded. If you want to handle the event in the same thread that is emitting the event rather than the thread that created the event handler then one simply uses the ''thread snake'', <code><nowiki>~~~~</nowiki></code>, which has the nice side effect of making it obvious that the lambda is being executed in a thread that may be different to that which is running the surrounding code: <pre> /* ... code ... */ ~~~~machine.started([](){ /* ... code ... */ }); /* ... code ... */ </pre> For defining events and triggering them: <pre> class foo { public: define_event(OurEvent, our_event, int) public: void something() { // Using event object directly OurEvent.trigger(42); // by default a synchronous trigger OurEvent.sync_trigger(42); // synchronous trigger OurEvent.async_trigger(42); // asynchronous trigger // Using event (virtual) function our_event().trigger(42); // by default a synchronous trigger our_event().sync_trigger(42); // synchronous trigger our_event().async_trigger(42); // asynchronous trigger } }; class i_xyzzy // an interface (abstract base) class { public: declare_event(our_event, int) public: virtual ~i_xyzzy() = default; public: virtual void qux() = 0; /* ... other interface methods or helper functions ... */ }; class xyzzy : public i_xyzzy // a concrete class implementing the above interface { public: define_declared_event(OurEvent, our_event, int) public: void qux() final {} /* ... code ... */ }; </pre> 49845bb39e14fcf7962c8e59b87a445033a5e7c5 Naming Convention 0 3 24 2024-05-05T15:02:40Z Leigh 1 Created page with "The neoGFX naming convention is based on the idea that to aid readability it is better to encode ''scope'' rather than ''type'' in an identifier name prefix. The idea of encoding scope in identifier names was introduced by the smartphone operating system ''Symbian OS''. The following table lists the various C++ syntactical constructs with their associated convention: {| class="wikitable" style="margin-left: 0px; margin-right: auto;" |+ neoGFX Naming Convention |- ! Co..." wikitext text/x-wiki The neoGFX naming convention is based on the idea that to aid readability it is better to encode ''scope'' rather than ''type'' in an identifier name prefix. The idea of encoding scope in identifier names was introduced by the smartphone operating system ''Symbian OS''. The following table lists the various C++ syntactical constructs with their associated convention: {| class="wikitable" style="margin-left: 0px; margin-right: auto;" |+ neoGFX Naming Convention |- ! Construct !! Convention !! Example !! Note |- | macro || UPPER_SNAKE_CASE || <code>MY_MACRO</code> || snake_case is used for in-class ''event definition'' macros |- | function name || snake_case || <code>my_function</code> |- | struct/class name || snake_case || <code>my_class</code> |- | interface class name || snake_case; <code>i_</code> prefix || <code>i_my_interface</code> || an ''interface class'' does not have any member variables, containing only pure virtual functions and any associated helper functions |- | enum class name || snake_case || <code>my_enum</code> |- | enum name || snake_case; <code>_e</code> suffix || <code>my_enum_e</code> |- | enumerator || UpperCamelCase || <code>MyEnumerator</code> |- | function parameter || CamelCase; <code>a</code> prefix || <code>myVariable</code> || "a" for ''argument'' |- | local variable || lowerCamelCase || <code>myVariable</code> |- | member variable (class) || CamelCase; <code>i</code> prefix || <code>iMyVariable</code> || "i" for class ''instance'' variable |- | member variable (struct) || lowerCamelCase || <code>myVariable</code> || use <code>struct</code> for classes that don't have a ''class invariant'' |- | variable with static storage duration || CamelCase; <code>s</code> prefix || <code>sMyVariable</code> |- | variable with thread local storage duration || CamelCase; <code>t</code> prefix || <code>tMyVariable</code> |- | event object || UpperCamelCase || <code>MyEvent</code> |- | event (virtual) function || snake_case || <code>my_event</code> |} Example class: <pre> class foo { public: foo(int aValue) : iValue{ aValue } { } public: int value() const { return iValue; } void something() { thread_local qux tQux; /* ... code ... */ } private: int iValue; }; </pre> 9225551563f0f92356f0b0c3ad312c6f57f68903 26 24 2024-05-05T15:03:17Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' naming convention is based on the idea that to aid readability it is better to encode ''scope'' rather than ''type'' in an identifier name prefix. The idea of encoding scope in identifier names was introduced by the smartphone operating system ''Symbian OS''. The following table lists the various C++ syntactical constructs with their associated convention: {| class="wikitable" style="margin-left: 0px; margin-right: auto;" |+ neoGFX Naming Convention |- ! Construct !! Convention !! Example !! Note |- | macro || UPPER_SNAKE_CASE || <code>MY_MACRO</code> || snake_case is used for in-class ''event definition'' macros |- | function name || snake_case || <code>my_function</code> |- | struct/class name || snake_case || <code>my_class</code> |- | interface class name || snake_case; <code>i_</code> prefix || <code>i_my_interface</code> || an ''interface class'' does not have any member variables, containing only pure virtual functions and any associated helper functions |- | enum class name || snake_case || <code>my_enum</code> |- | enum name || snake_case; <code>_e</code> suffix || <code>my_enum_e</code> |- | enumerator || UpperCamelCase || <code>MyEnumerator</code> |- | function parameter || CamelCase; <code>a</code> prefix || <code>myVariable</code> || "a" for ''argument'' |- | local variable || lowerCamelCase || <code>myVariable</code> |- | member variable (class) || CamelCase; <code>i</code> prefix || <code>iMyVariable</code> || "i" for class ''instance'' variable |- | member variable (struct) || lowerCamelCase || <code>myVariable</code> || use <code>struct</code> for classes that don't have a ''class invariant'' |- | variable with static storage duration || CamelCase; <code>s</code> prefix || <code>sMyVariable</code> |- | variable with thread local storage duration || CamelCase; <code>t</code> prefix || <code>tMyVariable</code> |- | event object || UpperCamelCase || <code>MyEvent</code> |- | event (virtual) function || snake_case || <code>my_event</code> |} Example class: <pre> class foo { public: foo(int aValue) : iValue{ aValue } { } public: int value() const { return iValue; } void something() { thread_local qux tQux; /* ... code ... */ } private: int iValue; }; </pre> f731d63db54023ca17a069ac74beee7a49181b72 27 26 2024-05-05T15:04:08Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' naming convention is based on the idea that to aid readability it is better to encode ''scope'' rather than ''type'' in an identifier name prefix. The idea of encoding scope in identifier names was introduced by the smartphone operating system ''Symbian OS''. The following table lists the various C++ syntactical constructs with their associated convention: {| class="wikitable" style="margin-left: 0px; margin-right: auto;" |+ neoGFX Naming Convention |- ! Construct !! Convention !! Example !! Note |- | macro || UPPER_SNAKE_CASE || <code>MY_MACRO</code> || snake_case is used for in-class ''event definition'' macros |- | function name || snake_case || <code>my_function</code> |- | struct/class name || snake_case || <code>my_class</code> |- | interface class name || snake_case; <code>i_</code> prefix || <code>i_my_interface</code> || an ''interface class'' does not have any member variables, containing only pure virtual functions and any associated helper functions |- | enum class name || snake_case || <code>my_enum</code> |- | enum name || snake_case; <code>_e</code> suffix || <code>my_enum_e</code> |- | enumerator || UpperCamelCase || <code>MyEnumerator</code> |- | function parameter || CamelCase; <code>a</code> prefix || <code>myVariable</code> || "a" for ''argument'' |- | local variable || lowerCamelCase || <code>myVariable</code> |- | member variable (class) || CamelCase; <code>i</code> prefix || <code>iMyVariable</code> || "i" for class ''instance'' variable |- | member variable (struct) || lowerCamelCase || <code>myVariable</code> || use <code>struct</code> for classes that don't have a ''class invariant'' |- | variable with static storage duration || CamelCase; <code>s</code> prefix || <code>sMyVariable</code> |- | variable with thread local storage duration || CamelCase; <code>t</code> prefix || <code>tMyVariable</code> |- | event object || UpperCamelCase || <code>MyEvent</code> |- | event (virtual) getter function || snake_case || <code>my_event</code> |} Example class: <pre> class foo { public: foo(int aValue) : iValue{ aValue } { } public: int value() const { return iValue; } void something() { thread_local qux tQux; /* ... code ... */ } private: int iValue; }; </pre> 85206bff0604a365cad042b7511ddd70e83b8f82 28 27 2024-05-05T15:04:57Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' naming convention is based on the idea that to aid readability of C++ code it is better to encode ''scope'' rather than ''type'' in an identifier name prefix. The idea of encoding scope in identifier names was introduced by the smartphone operating system ''Symbian OS''. The following table lists the various C++ syntactical constructs with their associated convention: {| class="wikitable" style="margin-left: 0px; margin-right: auto;" |+ neoGFX Naming Convention |- ! Construct !! Convention !! Example !! Note |- | macro || UPPER_SNAKE_CASE || <code>MY_MACRO</code> || snake_case is used for in-class ''event definition'' macros |- | function name || snake_case || <code>my_function</code> |- | struct/class name || snake_case || <code>my_class</code> |- | interface class name || snake_case; <code>i_</code> prefix || <code>i_my_interface</code> || an ''interface class'' does not have any member variables, containing only pure virtual functions and any associated helper functions |- | enum class name || snake_case || <code>my_enum</code> |- | enum name || snake_case; <code>_e</code> suffix || <code>my_enum_e</code> |- | enumerator || UpperCamelCase || <code>MyEnumerator</code> |- | function parameter || CamelCase; <code>a</code> prefix || <code>myVariable</code> || "a" for ''argument'' |- | local variable || lowerCamelCase || <code>myVariable</code> |- | member variable (class) || CamelCase; <code>i</code> prefix || <code>iMyVariable</code> || "i" for class ''instance'' variable |- | member variable (struct) || lowerCamelCase || <code>myVariable</code> || use <code>struct</code> for classes that don't have a ''class invariant'' |- | variable with static storage duration || CamelCase; <code>s</code> prefix || <code>sMyVariable</code> |- | variable with thread local storage duration || CamelCase; <code>t</code> prefix || <code>tMyVariable</code> |- | event object || UpperCamelCase || <code>MyEvent</code> |- | event (virtual) getter function || snake_case || <code>my_event</code> |} Example class: <pre> class foo { public: foo(int aValue) : iValue{ aValue } { } public: int value() const { return iValue; } void something() { thread_local qux tQux; /* ... code ... */ } private: int iValue; }; </pre> 49720a605a27375b3fc796ea7c5567e775d4c4b2 29 28 2024-05-05T15:06:02Z Leigh 1 wikitext text/x-wiki The ''neoGFX'' naming convention is based on the idea that to aid readability of C++ code it is better to encode ''scope'' rather than ''type'' in an identifier name prefix. The idea of encoding scope in identifier names was introduced by the smartphone operating system ''Symbian OS''. The following table lists the various C++ syntactical constructs with their associated convention: {| class="wikitable" style="margin-left: 0px; margin-right: auto;" |+ neoGFX Naming Convention |- ! Construct !! Convention !! Example !! Note |- | macro || UPPER_SNAKE_CASE || <code>MY_MACRO</code> || snake_case is used for in-class ''event definition'' macros |- | function name || snake_case || <code>my_function</code> |- | struct/class name || snake_case || <code>my_class</code> |- | interface class name || snake_case; <code>i_</code> prefix || <code>i_my_interface</code> || an ''interface class'' does not have any member variables, containing only pure virtual functions and any associated helper functions |- | enum class name || snake_case || <code>my_enum</code> |- | enum name || snake_case; <code>_e</code> suffix || <code>my_enum_e</code> || C-style enums |- | enumerator || UpperCamelCase || <code>MyEnumerator</code> |- | function parameter || CamelCase; <code>a</code> prefix || <code>myVariable</code> || "a" for ''argument'' |- | local variable || lowerCamelCase || <code>myVariable</code> |- | member variable (class) || CamelCase; <code>i</code> prefix || <code>iMyVariable</code> || "i" for class ''instance'' variable |- | member variable (struct) || lowerCamelCase || <code>myVariable</code> || use <code>struct</code> for classes that don't have a ''class invariant'' |- | variable with static storage duration || CamelCase; <code>s</code> prefix || <code>sMyVariable</code> |- | variable with thread local storage duration || CamelCase; <code>t</code> prefix || <code>tMyVariable</code> |- | event object || UpperCamelCase || <code>MyEvent</code> |- | event (virtual) getter function || snake_case || <code>my_event</code> |} Example class: <pre> class foo { public: foo(int aValue) : iValue{ aValue } { } public: int value() const { return iValue; } void something() { thread_local qux tQux; /* ... code ... */ } private: int iValue; }; </pre> f6bd894531261945a23a0de0ffda58907f695e13